class Unit < ActiveRecord::Base
  validates_presence_of :name

  has_many :troops, :dependent => :destroy

  def essenzen
    self[:essenzen] or 0
  end

  def kristalle
    self[:kristalle] or 0
  end

  def kraftsteine
    self[:kraftsteine] or 0
  end

  def goldharz
    self[:goldharz] or 0
  end
end
